import request from '@/utils/request'

let prefix = import.meta.env.VITE_APP_YYJC_API
/* 服务目录列表 */
export function serviceCatalogPage(param) {
    return request({
        url: prefix + '/integrate/service/List',
        method: 'get',
        params: param,
    })
}

/* 文件上传 */
export function uploadFiles(data) {
    return request({
        url: prefix + '/integrate/service/import',
        method: 'post',
        data,
        headers: {
            'Content-Type': 'multipart/form-data',
        },
    })
}

/* 文件导出 */
export function exportSysApp(params) {
    return request({
        url: prefix + '/integrate/service/export',
        method: 'get',
        params,
        responseType: 'blob',
    })
}

/* 上下线 */
export function servicePatch(data) {
    return request({
        url: prefix + '/integrate/service/status/patch',
        method: 'patch',
        data,
    })
}

/* 批量删除 */
export function serviceDelete(data) {
    return request({
        url: prefix + '/integrate/service/delete',
        method: 'delete',
        data,
    })
}

/* 删除 */
export function serviceDeleteId(id) {
    return request({
        url: prefix + `/integrate/service/delete/${id}`,
        method: 'delete',
    })
}

/* 获取详情 */
export function getServiceCatalogDetail(id) {
    return request({
        url: prefix + `/integrate/service/detail/${id}`,
        method: 'get',
    })
}

/* 流量控制 */
export function serviceFlowControl(data) {
    return request({
        url: prefix + '/integrate/service/limitCount/patch',
        method: 'patch',
        data,
    })
}

/* 添加服务 */
export function addService(data) {
    return request({
        url: prefix + '/integrate/service/insert',
        method: 'post',
        data,
    })
}

/* 编辑服务 */
export function updateService(data) {
    return request({
        url: prefix + '/integrate/service/update',
        method: 'put',
        data,
    })
}

/* 黑白名单 */
export function getBlackWhiteList(id) {
    return request({
        url: prefix + `/integrate/service/blackWhiteList/${id}`,
        method: 'get',
    })
}

/* 服务授权 */
export function serviceAuth(data) {
    return request({
        url: prefix + `/integrate/service/auth`,
        method: 'put',
        data,
    })
}
